package com.market.web.model;

import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.market.domain.Message;
@Component("messageModel")
@Scope("session")
public class MessageModel extends GenericModel<Message> {
	
	
	public List<SelectItem> getMessageTypes(){
		List<SelectItem> types = new ArrayList<SelectItem>();
		for(Message.TYPE type:Message.TYPE.values()){
			SelectItem item = new SelectItem(type, type.getLabel());
			types.add(item);
		}
		return types;
	}
	
	@Override
	public Message getNewObject() {
		Message message = new Message();
		message.setIsNew(true);
		return message;
	}

}
